package fuliwei.servlet;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


public class BaseServlet extends HttpServlet {
  private static final String PREFIX = "/ff/";
  private static final String SUFFIX = ".jsp";

    /**
     * 页面转发方法
     * @param filename
     * @param request
     * @param response
     * @throws ServletException
     * @throws IOException
     */
  public void dispatcher(String filename,HttpServletRequest request,
                         HttpServletResponse response) throws ServletException, IOException {
      request.getRequestDispatcher(PREFIX+filename+SUFFIX).forward(request, response);
  }

    /**
     * 获取页面请求指令
     * @param request
     * @param tacit
     * @return
     */
  public String  getM(HttpServletRequest request,String tacit){
      String m = request.getParameter("m");
      return (m==null?tacit:m);
  }

}
